<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitepage
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: index.tpl 2011-05-05 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
?>
<script type="text/javascript">
  var tagAction =function(tag) 
  {
    $('tag').value = tag;
    $('filter_form').submit();
  }
</script>

<ul class="sitepage_sidebar_info">
  <form id='filter_form' class='global_form_box' method='get' action='<?php echo $this->url(array('action' => 'index'), 'sitepage_general', true) ?>' style='display: none;'>
    <input type="hidden" id="tag" name="tag" value=""/>
    <input type="hidden" id="category" name="category" value=""/>
    <input type="hidden" id="subcategory" name="subcategory" value=""/>
    <input type="hidden" id="subsubcategory" name="subsubcategory" value=""/>
    <input type="hidden" id="categoryname" name="categoryname" value=""/>	
    <input type="hidden" id="subcategoryname" name="subcategoryname" value=""/>
    <input type="hidden" id="subsubcategoryname" name="subsubcategoryname" value=""/>
    <input type="hidden" id="start_date" name="start_date" value="<?php if ($this->start_date)
  echo $this->start_date; ?>"/>
    <input type="hidden" id="end_date" name="end_date" value="<?php if ($this->end_date)
             echo $this->end_date; ?>"/>
  </form>
  <li>
    <?php if ($this->category_name != '' && $this->subcategory_name == '') : ?>
      <?php echo $this->translate('Category:'); ?>
      <?php echo $this->htmlLink($this->url(array('category_id' => $this->sitepage->category_id, 'categoryname' => Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategorySlug($this->category_name)), 'sitepage_general_category'), $this->translate($this->category_name)) ?>
    <?php elseif ($this->category_name != '' && $this->subcategory_name != ''): ?> 
      <?php echo $this->translate('Category:'); ?>
      <?php echo $this->htmlLink($this->url(array('category_id' => $this->sitepage->category_id, 'categoryname' => Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategorySlug($this->category_name)), 'sitepage_general_category'), $this->translate($this->category_name)) ?>
      <?php if (!empty($this->category_name)): echo '&raquo;';endif; ?>      
      <?php echo $this->htmlLink($this->url(array('category_id' => $this->sitepage->category_id, 'categoryname' => Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategorySlug($this->category_name), 'subcategory_id' => $this->sitepage->subcategory_id, 'subcategoryname' => Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategorySlug($this->subcategory_name)), 'sitepage_general_subcategory'), $this->translate($this->subcategory_name)) ?>
      <?php if(!empty($this->subsubcategory_name)): echo '&raquo;';?>
        <?php echo $this->htmlLink($this->url(array('category_id' => $this->sitepage->category_id, 'categoryname' => Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategorySlug($this->category_name), 'subcategory_id' => $this->sitepage->subcategory_id, 'subcategoryname' => Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategorySlug($this->subcategory_name),'subsubcategory_id' => $this->sitepage->subsubcategory_id, 'subsubcategoryname' => Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategorySlug($this->subsubcategory_name)), 'sitepage_general_subsubcategory'),$this->translate($this->subsubcategory_name)) ?>
	   	<?php endif; ?>
      <?php endif; ?>
  </li>
  <?php if (count($this->sitepageTags) > 0): $tagCount = 0; ?>
    <li>
      <?php echo $this->translate('Tags:'); ?>
      <?php foreach ($this->sitepageTags as $tag): ?>
        <?php if (!empty($tag->getTag()->text)): ?>
          <?php if (empty($tagCount)): ?>
            <a href='javascript:void(0);' onclick='javascript:tagAction(<?php echo $tag->getTag()->tag_id; ?>);'>#<?php echo $tag->getTag()->text ?></a>
            <?php $tagCount++;
          else: ?>
            <a href='javascript:void(0);' onclick='javascript:tagAction(<?php echo $tag->getTag()->tag_id; ?>);'>#<?php echo $tag->getTag()->text ?></a>
          <?php endif; ?>
      <?php endif; ?>
    <?php endforeach; ?>
    </li>
  <?php endif; ?>
  <li>
    <ul>
      <li>
        <?php echo $this->translate('Last updated %s', $this->timestamp($this->sitepage->modified_date)) ?>
      </li>        
      <?php if (!empty($this->sitepage->like_count)): ?>
        <li>
          <?php echo $this->translate($this->sitepage->like_count) ?>  <?php echo $this->translate('Total likes') ?>
        </li>
      <?php endif; ?>
    </ul>
  </li>
</ul>